package cc.wanforme.fsync;

import cc.wanforme.fsync.server.ServerCenter;
import cc.wanforme.fsync.task.CronTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class AfterStartUp implements CommandLineRunner {

    private ServerCenter serverCenter;
    private CronTask cronTask;

    @Override
    public void run(String... args) throws Exception {
        serverCenter.initClients();
        cronTask.setupAllCronTasks();
    }

    @Autowired
    public void setServerCenter(ServerCenter serverCenter) {
        this.serverCenter = serverCenter;
    }
    @Autowired
    public void setCronTask(CronTask cronTask) {
        this.cronTask = cronTask;
    }
}
